package org.fpaadmin.web;

import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.markup.repeater.data.DataView;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.fpaadmin.entity.DataGroup;

public class ApplicationDataGroups extends TemplatePage {

    private static final long serialVersionUID = 1L;
    
    public ApplicationDataGroups(final PageParameters parameters) {
        
        add(new DataView<DataGroup>("data-group", new DataGroupProvider(this)) {
            private static final long serialVersionUID = 1L;
            @Override
            protected void populateItem(final Item<DataGroup> item) {
                DataGroup dataGroup = item.getModelObject();
                item.add(new Label("data-group-name", dataGroup.getName()));
            }
        });
    }
}

class DataGroupProvider extends GenericDataProvider<DataGroup> {

	private static final long serialVersionUID = 1L;

	public DataGroupProvider(TemplatePage page) {
		super(page);
	}

	@Override
	protected Class<DataGroup> getGenericClass() {
		return DataGroup.class;
	}
}
